<?php

namespace app\common\model\mysql;


class ProjectModel extends BaseModel
{
    protected $table = 'pro_project';


    public function category()
    {
        return $this->belongsTo(CategoryModel::class, 'category_id', 'id');
    }

    public function getThumbAttr($value)
    {
        return empty($value) ? '' : config('app.upload_host') . $value;
    }

    public function getLabelIdsAttr($value)
    {
        if ($value) {
            return explode(',', $value);
        }
        return [];
    }

    public function level()
    {
        return $this->hasOne(UserLevelModel::class, 'id', 'at_level');
    }

}